const Utils = require('./Utils.js')

Utils.init()

let seconds = 0
let num = 0
let flag = true
while (flag) {
    sleep(1000)
    if (Utils.findPictureTap('准备')) {
        num++
        if (num === 1) seconds = 900
        else seconds = 40
        Utils.waitTime(seconds)
        if (num != 4) {
            while (!Utils.findPicture('准备')) {
                sleep(1000)
                seconds += 2
                log('已等待 ' + seconds + ' 秒')
            }
        }
    }
    log('已等待 ' + ++seconds + ' 秒')
    if (Utils.findPictureTap('胜利')) {
        log('阴界之门 - 成功')
        Utils.tapPicture("返回二")
        Utils.tapPicture("返回一")
        flag = false
    }
}